/**
 * Create by CaoWenjian
 *
 * @copyRight: 2018
 **/
package com.bjboot.caocao.common.utils;

import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 *@Description Http请求工具类
 *@Author 操文健
 *@Date 2018-09-20 上午8:50
 *@Version 1.0
 **/
public class HttpServletUtils {

    /**
     * 判断是否为Ajax请求  默认不是
     * @param req
     * @return
     */
    public static boolean jsAjax(HttpServletRequest req){
        boolean isAjaxRequest = false;
        if(!StringUtils.isBlank(req.getHeader("x-requested-with")) && req.getHeader("x-requested-with").equals("XMLHttpRequest")){
            isAjaxRequest = true;
        }
        return isAjaxRequest;
    }
}
